<template>
  <div class="container">
    <el-dialog title="图标库" :visible.sync="dialogShow" width="600px">
      <div class="wxkj-tab">
        <el-tabs v-model="active">
          <el-tab-pane label="库1" name="1">
            <div class="list">
              <div
                v-for="item of elementIcons"
                :key="item"
                class="item"
                @click="selected('el-icon-' + item)"
              >
                <i :class="'el-icon-' + item" />
                <span>el-icon-{{ item }}</span>
              </div>
            </div>
          </el-tab-pane>
          <el-tab-pane label="库2" name="2">
            <div class="list">
              <div
                v-for="item of wykjIcons"
                :key="item"
                class="item"
                @click="selected('iconfont '+item)"
              >
                <i class="iconfont" :class="item" />
                <span>{{ item }}</span>
              </div>
            </div>
          </el-tab-pane>
        </el-tabs>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogShow = false">关 闭</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import elementIcons from './element-icons'
import wykjIcons from './wykj-icons'
export default {
  name: '',
  components: { elementIcons, wykjIcons },
  props: {},
  data() {
    return {
      active: '1',
      elementIcons,
      wykjIcons,
      dialogShow: false
    }
  },
  // 生命周期 - 创建完成（可以访问当前this实例）
  created() {},
  // 生命周期 - 挂载完成（可以访问DOM元素）
  mounted() {},
  // 销毁
  destroyed() {},
  // 方法
  methods: {
    show() {
      this.dialogShow = true
    },
    selected(icon) {
      this.$emit('icon', icon)
      this.dialogShow = false
    }
  }
}
</script>
<style lang="scss" scoped>
::v-deep {
  .el-dialog__body {
    height: 60vh;
    padding: 0;
  }
  .el-tabs{
    height: 100%;
  }
  .el-tabs__content{
    height: calc(100% - 50px);
    overflow: auto;
  }
  /*滚动条样式*/
.el-tabs__content::-webkit-scrollbar {
  width: 8px;
  /*height: 4px;*/
}
.el-tabs__content::-webkit-scrollbar-thumb {
  border-radius: 10px;
  -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  background: rgba(0, 0, 0, 0.2);
}
.el-tabs__content::-webkit-scrollbar-track {
  -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  border-radius: 0;
  background: rgba(0, 0, 0, 0.1);
}
}
.wxkj-tab{
  height: 100%;
}
.list {
  position: relative;
  display: grid;
  height: 100%;

  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
}

.item {
  margin: 20px;
  height: 85px;
  text-align: center;
  width: 100px;
  float: left;
  font-size: 30px !important;
  color: #24292e;
  cursor: pointer;
  span {
    display: block;
    font-size: 16px;
    margin-top: 10px;
  }
  .iconfont{
    font-size: 30px !important;
  }
}
</style>
